interface Order {
    status: number
}

enum OrderStatus {
    Pending,
    Shipped,
    Completed,
    Cancelled,
    Unknown,
}

type orderHandler = (order: Order) => void;

const orderHandlers: Record<number, orderHandler> = {
    [OrderStatus.Pending]: order => { },
    [OrderStatus.Shipped]: order => { },
    [OrderStatus.Completed]: order => { },
    [OrderStatus.Cancelled]: order => { },
    [OrderStatus.Unknown]: order => { }
}

function processOrder(order: Order) {
    const handler = orderHandlers[order.status] || orderHandlers[OrderStatus.Unknown];
    handler(order);
}
